/*
 Navicat Premium Data Transfer

 Source Server         : Jia
 Source Server Type    : MySQL
 Source Server Version : 80035 (8.0.35)
 Source Host           : localhost:3306
 Source Schema         : pandamovie

 Target Server Type    : MySQL
 Target Server Version : 80035 (8.0.35)
 File Encoding         : 65001

 Date: 07/06/2024 19:49:29
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for bill
-- ----------------------------
DROP TABLE IF EXISTS `bill`;
CREATE TABLE `bill` (
  `bill_id` bigint NOT NULL COMMENT '订单编号',
  `pay_state` tinyint NOT NULL COMMENT '支付状态，0未支付，1已支付',
  `user_id` bigint NOT NULL COMMENT '用户编号\n',
  `seats` json NOT NULL COMMENT '购买的座位号，可能为多个，使用json传输',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `cancel_time` varchar(255) NOT NULL COMMENT '取消时间，标志用户取消订单，非系统超时取消',
  `session_id` bigint NOT NULL COMMENT '场次编号'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of bill
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for cinema
-- ----------------------------
DROP TABLE IF EXISTS `cinema`;
CREATE TABLE `cinema` (
  `cinema_id` bigint NOT NULL COMMENT '影厅编号',
  `cinema_name` varchar(255) NOT NULL COMMENT '影厅名称',
  `hall_category_li` json DEFAULT NULL COMMENT '拥有影厅级别',
  `cinema_phone` varchar(255) NOT NULL COMMENT '影厅联系电话',
  `work_strat_time` varchar(255) DEFAULT NULL COMMENT '开始营业时间',
  `work_end_time` varchar(255) DEFAULT NULL COMMENT '结束营业时间',
  PRIMARY KEY (`cinema_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of cinema
-- ----------------------------
BEGIN;
INSERT INTO `cinema` (`cinema_id`, `cinema_name`, `hall_category_li`, `cinema_phone`, `work_strat_time`, `work_end_time`) VALUES (1001, '北海万达影城', '[\"激光厅\", \"IMAX厅\", \"CGS中国巨幕厅\", \"杜比全景声厅\", \"Dolby Cinema厅\", \"RealD厅\", \"RealD 6FLag厅\", \"LUXE巨幕厅\", \"4DX厅\", \"DTS:X 临镜音厅\", \"儿童厅\", \"4K厅\", \"60帧厅\", \"巨幕厅\", \"MX4D厅\"]', '887799', '7：00', '23:00');
COMMIT;

-- ----------------------------
-- Table structure for hall
-- ----------------------------
DROP TABLE IF EXISTS `hall`;
CREATE TABLE `hall` (
  `cinema_id` bigint NOT NULL COMMENT '影院编号',
  `hall_id` bigint NOT NULL COMMENT '影厅编号',
  `hall_name` varchar(255) NOT NULL COMMENT '影厅名称',
  `hall_category` varchar(255) NOT NULL COMMENT '影厅类别',
  `row_nums` smallint NOT NULL COMMENT '总排数',
  `seats_num_row` smallint NOT NULL COMMENT '每排座位数',
  `seat_nums` smallint NOT NULL COMMENT '总可用座位数，用于判断影厅是否坐满\n'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of hall
-- ----------------------------
BEGIN;
INSERT INTO `hall` (`cinema_id`, `hall_id`, `hall_name`, `hall_category`, `row_nums`, `seats_num_row`, `seat_nums`) VALUES (1, 1, '1号激光厅', '激光厅', 10, 10, 91);
INSERT INTO `hall` (`cinema_id`, `hall_id`, `hall_name`, `hall_category`, `row_nums`, `seats_num_row`, `seat_nums`) VALUES (1, 2, '2号厅', 'IMAX厅', 10, 18, 160);
INSERT INTO `hall` (`cinema_id`, `hall_id`, `hall_name`, `hall_category`, `row_nums`, `seats_num_row`, `seat_nums`) VALUES (1, 3, '3号厅', '杜比全景声厅', 7, 7, 49);
INSERT INTO `hall` (`cinema_id`, `hall_id`, `hall_name`, `hall_category`, `row_nums`, `seats_num_row`, `seat_nums`) VALUES (1, 6, '6号厅', '巨幕厅', 20, 18, 360);
INSERT INTO `hall` (`cinema_id`, `hall_id`, `hall_name`, `hall_category`, `row_nums`, `seats_num_row`, `seat_nums`) VALUES (14, 3, '7号厅', '儿童厅', 40, 25, 190);
COMMIT;

-- ----------------------------
-- Table structure for movie
-- ----------------------------
DROP TABLE IF EXISTS `movie`;
CREATE TABLE `movie` (
  `movie_id` int NOT NULL COMMENT '电影编号\n',
  `movie_name` varchar(255) NOT NULL COMMENT '电影名称',
  `movie_length` double DEFAULT NULL COMMENT '电影时长',
  `movie_poster` varchar(255) DEFAULT NULL COMMENT '电影海报',
  `movie_area` varchar(255) DEFAULT NULL COMMENT '电影区域',
  `release_date` datetime DEFAULT NULL COMMENT '上映时间',
  `movie_box_office` varchar(255) NOT NULL COMMENT '电影总票房',
  `movie_introduction` varchar(255) DEFAULT NULL COMMENT '电影简介',
  `movie_pictures` varchar(255) DEFAULT NULL COMMENT '电影图集',
  `del_state` varchar(255) NOT NULL COMMENT '删除标记'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of movie
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for orders
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
  `Id` int NOT NULL,
  `orderId` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `num` varchar(40) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `price` float DEFAULT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `shoutime` varchar(6) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  PRIMARY KEY (`Id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of orders
-- ----------------------------
BEGIN;
INSERT INTO `orders` (`Id`, `orderId`, `num`, `price`, `name`, `shoutime`) VALUES (1, '001', '200', 50, '冰雪奇缘2', '');
INSERT INTO `orders` (`Id`, `orderId`, `num`, `price`, `name`, `shoutime`) VALUES (2, '002', '200', 48, '小妇人', '');
INSERT INTO `orders` (`Id`, `orderId`, `num`, `price`, `name`, `shoutime`) VALUES (3, '003', '180', 49, '利刃出销', '');
INSERT INTO `orders` (`Id`, `orderId`, `num`, `price`, `name`, `shoutime`) VALUES (4, '004', '200', 58, '勇敢者游戏', '');
INSERT INTO `orders` (`Id`, `orderId`, `num`, `price`, `name`, `shoutime`) VALUES (5, '005', '200', 50, '小丑', '');
COMMIT;

-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
  `role_id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '角色编号',
  `role_name` varchar(255) NOT NULL COMMENT '角色名称',
  `role_desc` varchar(255) NOT NULL COMMENT '角色描述',
  PRIMARY KEY (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of role
-- ----------------------------
BEGIN;
INSERT INTO `role` (`role_id`, `role_name`, `role_desc`) VALUES (1, '系统管理员', '管理整个影院在线售票系统');
INSERT INTO `role` (`role_id`, `role_name`, `role_desc`) VALUES (2, '影院管理员', '管理其所属的影院的相关信息');
INSERT INTO `role` (`role_id`, `role_name`, `role_desc`) VALUES (3, '用户', '用户，仅能使用前台浏览相关信息、下单、修改个人信息等功能');
COMMIT;

-- ----------------------------
-- Table structure for session
-- ----------------------------
DROP TABLE IF EXISTS `session`;
CREATE TABLE `session` (
  `session_id` bigint NOT NULL COMMENT '场次编号\n',
  `hall_id` bigint NOT NULL COMMENT '影厅编号',
  `language_ver` varchar(255) NOT NULL COMMENT '语言版本\n',
  `movie_id` bigint NOT NULL COMMENT '电影编号',
  `play_time` varchar(255) NOT NULL COMMENT '开场时间',
  `end_time` varchar(255) NOT NULL COMMENT '散场时间',
  `session_date` date NOT NULL COMMENT '场次日期',
  `session_price` decimal(10,2) NOT NULL COMMENT '票价',
  `session_seats` json NOT NULL COMMENT '座位信息，采用{key: [], key: []}存储每一个座位的状态，其中key表示排，数组(下标+1)表示几号座，存储的值为0表示可选，1表示空(无座位)，值为2表示已选择，值为3表示已售出，',
  `seat_nums` smallint DEFAULT NULL COMMENT '总座位数',
  `sall_nums` smallint NOT NULL COMMENT '售出座位数',
  PRIMARY KEY (`session_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of session
-- ----------------------------
BEGIN;
INSERT INTO `session` (`session_id`, `hall_id`, `language_ver`, `movie_id`, `play_time`, `end_time`, `session_date`, `session_price`, `session_seats`, `seat_nums`, `sall_nums`) VALUES (17, 1, '国语2D', 1, '17：30', '19:50', '2024-06-26', 36.00, '0', 100, 0);
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名',
  `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
  `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `role_id` int NOT NULL COMMENT '角色编号',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` (`id`, `username`, `password`, `email`, `role_id`) VALUES (1, 'Ruby', '123456', '2722443977@qq.com', 1);
INSERT INTO `user` (`id`, `username`, `password`, `email`, `role_id`) VALUES (2, 'Rita', '123456', '2122443977@qq.com', 2);
INSERT INTO `user` (`id`, `username`, `password`, `email`, `role_id`) VALUES (3, 'Tonny', '123456', '2222443977@qq.com', 3);
INSERT INTO `user` (`id`, `username`, `password`, `email`, `role_id`) VALUES (4, 'Alimon', '111111', '2222243977@qq.com', 4);
INSERT INTO `user` (`id`, `username`, `password`, `email`, `role_id`) VALUES (5, 'Amy', '222222', '2722443999@qq.com', 5);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
